<?
session_start();
if (!isset($_SESSION[login])) {
     header("Location: HomeIndex.php");
     exit;
}
?>
<!DOCTYPE html>
<html lang="en">
<head>
<title>Edit Upload Student</title>
<meta charset="utf-8">
<meta name="description" content="Place your description here">
<meta name="keywords" content="put, your, keyword, here">
<meta name="author" content="Templates.com - website templates provider">
<link rel="stylesheet" href="css/reset.css" type="text/css" media="all">
<link rel="stylesheet" href="css/style.css" type="text/css" media="all">
<script type="text/javascript" src="js/jquery-1.4.2.min.js" ></script>
<script type="text/javascript" src="js/cufon-yui.js"></script>
<script type="text/javascript" src="js/cufon-replace.js"></script>
<script type="text/javascript" src="js/script.js"></script>
<!--[if lt IE 7]>
     <link rel="stylesheet" href="css/ie/ie6.css" type="text/css" media="screen">
     <script type="text/javascript" src="js/ie_png.js"></script>
     <script type="text/javascript">
        ie_png.fix('.png, footer, header nav ul li a, .nav-bg, .list li img');
     </script>
<![endif]-->
<!--[if lt IE 9]>
  	<script type="text/javascript" src="js/html5.js"></script>
  <![endif]-->
</head>
<body id="page1">
<div class="wrap">
   <!-- header -->
   <header>
      <div class="container">
         <h1><a href="homeStudent.php">Student Portfolio Management System</a></h1>
         <nav>
            <ul>
               <li class="current"><a href="homeStudent.php" class="m1">หน้าแรก</a></li>
               <li><a href="searchStudent.php" class="m1">ค้นหา</a></li>
               <li><a href="uploadStudent.php" class="m1">อัพโหลด</a></li>
               <li class="last"><a href="reportStudent.php" class="m5">ออกรายงาน</a></li>
            </ul>
         </nav>
         <form action="" id="search-form">
            <fieldset>
            <div class="rowElem">
               <input type="text">
               <a href="#" onClick="document.getElementById('search-form').submit()">ค้นหา</a></div>
            </fieldset>
         </form>
      </div>
   </header>
   <div class="container">
      <!-- aside -->
      <aside>
         <div class="wrap">
   <!-- header -->
   <div class="container">
      <!-- aside -->
      <aside><h2 align ="left">ยินดีต้อนรับ</h2> 
     <p><? echo $_SESSION["ses_name"]; ?></p>
      <input name="editSelf" type="button" value="แก้ไขข้อมูลส่วนตัว" onClick="window.location='homeStudent.php'"><br><br>
	  <input name="manage" type="button" value="แก้ไขข้อมูลผลงาน" onClick="window.location='manageProjectStudent.php'"><br><br>
      <input name="logOut" type="button" value="ออกจากระบบ" onClick="window.location='logout.php'">
</aside>	 
      <!-- content -->
      <section id="content">   
         <div class="inside">       
         </div>
      </section>
   </div>
</div>
      </aside>
     <!-- content -->
     <section id="content">
       <div class="inside">
         <? require("connectDB.php");

$sql = mysql_query("select  *  from project where project_id = '$id'");

while($result = mysql_fetch_array($sql))    { ?>
<form action="updateProjectStudent.php" method="post" name="edit">

<table cellpadding="5">

<TR>
<TD height="30">ชื่อผลงาน</TD>
<TD> <input type="text" name="pname" value='<? echo $result["project_name"]; ?>'></TD>
</TR>
<TR>
<TD height="30">ชื่อเจ้าของผลงาน</TD>
<TD> 
<? echo $result["owner_name"]; ?>
</TD>
</TR>
<TR>
<TD height="30">รหัสนักศึกษา</TD>
<TD> 
<? echo $result["student_id"]; ?>
</TD>
</TR>
<TR>
<TD height="30">สาขาวิชา</TD>
<td><? echo $result["major"] ?></TD>
</TR>
<TR>
<TD height="30">รายวิชา</TD>
<TD> 
<select name="subject">
                 <option><?echo $result["subject"]?></option>
                 <?
	$query_list=mysql_query("Select * From subject");
	while($arrL= mysql_fetch_array($query_list))
	{
	?>
                 <option><? echo $arrL['subject'];?></option>
                 <?
	}
	?>
               </select></td>
</TR>
<TR>
<TD height="30">อาจารย์ประจำวิชา</TD>
<TD> 
<input type="text" name="tname" value='<? echo $result["subject_teacher"]; ?>'>
</TD>
</TR>
<TR>
<TD height="30">อีเมล์(E-mail)</TD>
<TD> 
<input type="text" name="mail" value='<? echo $result["email"]; ?>'>
</TD>
</TR>
<TR>
<TD >เฟสบุ๊ค(Facebook)</TD>
<TD> 
<input type="text" name="fb" value='<? echo $result["facebook"]; ?>'>
</TD>
</TR>
<TR>
<TD height="30">รายละเอียดผลงาน</TD>
<TD> 
<textarea name="comment"><? echo $result["comment_text"]; ?></textarea>
</TD>
</TR>
<TR>
<TD height="30">ประเภทผลงาน</TD>
<TD> 
<select name="type">
                 <option><?echo $result["project_type"]?></option>
                 <?
	$query_list=mysql_query("Select * From project_type");
	while($arrL= mysql_fetch_array($query_list))
	{
	?>
                 <option><? echo $arrL['project_type'];?></option>
                 <?
	}
	?>
               </select></td>
</TR>
<TD >สถานะผลงาน</TD>
<TD> 
<select name="status">
			<option><?echo $result["project_status"]?></option>
                 <?
	$query_list=mysql_query("Select * From project_status");
	while($arrL= mysql_fetch_array($query_list))
	{
	?>
                 <option><? echo $arrL['project_status'];?></option>
                 <?
	}
	?>
               </select></TD>
</TR>
<TR>
<td>
<input type="hidden" name="id" value='<? echo $result["project_id"]; ?>'>
</td>
<td> <input type="submit" name="btnOk" value="บันทึก" style="cursor=hand">&nbsp;<input type="button" name="btn" id="btn" value="ยกเลิก" onclick="window.location='manageProjectStudent.php'"></td>
</TR>
</table>
</form>
<? }

mysql_free_result($sql);
mysql_close($con); ?>
       </div>
     </section>
   </div>
   </section>  
   </body>
</html>
